<?php

class TicketController extends BaseController
{

	/**
	 * 优惠券管理
	 */
	public function actionAdmin()
	{
		$model=new Ticket('search');
		$model->unsetAttributes();  // 清空属性
		$model->zti_status = array(1,2);//状态不为凹陷
		if(isset($_GET['Ticket']))
			$model->attributes=$_GET['Ticket'];
	
		$this->render('admin',array(
				'model'=>$model,
		));
	}


	/**
	 * 单条批量删除
	 */
	public function actionDelete()
	{
		//操作ID号格式处理
		if(isset($_GET['id'])){
			$id = $_GET['id'];
		}elseif(isset($_POST['ids'])){
			$id =$_POST['ids'];
		}else{
			throw new CHttpException(400,'Invalid request. Please do not repeat this request again.');
		}
		$id = is_array($id)?join(',',$id):(int)$id;
		//处理条件
		$criteria=new CDbCriteria;
		$criteria->addCondition("zti_id in ($id)");
		//修改内容
		$set = array('zti_status'=>'3');
		//执行操作
		if(Ticket::model()->updateAll($set,$criteria)){
			//成功跳转
			$this->redirect(Yii::app()->request->urlReferrer);
		}
	}





}
